# Maintainer: Muflone http://www.muflone.com/contacts/english/

pkgname=perl-goocanvas2
_perl_module=GooCanvas2
pkgver=0.06
pkgrel=6
pkgdesc="Perl bindings for GooCanvas2 widget using Glib::Object::Introspection"
arch=('any')
url="https://metacpan.org/release/${_perl_module}"
license=('PerlArtistic' 'GPL')
depends=('perl-gtk3' 'goocanvas')
replaces=('perl-goo-canvas2')
conflicts=('perl-goo-canvas2')
source=("https://cpan.metacpan.org/authors/id/P/PE/PERLMAX/${_perl_module}-${pkgver}.tar.gz")
sha256sums=('e24c87873e19063dd4d5e2c709caacf8c0ae8881044395bb865dc2b4fdd63b50')
options=('!emptydirs')

prepare() {
  cd "${_perl_module}-${pkgver}"
  sed -i "s/version => '2.0'/version => '3.0'/" lib/GooCanvas2.pm
}

build() {
  cd "${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
  perl Makefile.PL
  make
}

check() {
  cd "${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1
  make test
}

package() {
  cd "${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  make pure_install INSTALLDIRS=vendor DESTDIR="${pkgdir}"
  # Delete unuseful files
  find "${pkgdir}" -name '.packlist' -delete
}
